﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace CADTool
{
    public static class MathTool
    {
        /// <summary>
        /// 角度转弧度
        /// </summary>
        /// <param name="angle">角度</param>
        /// <returns>弧度</returns>
        public static double AngToRed(this double angle)
        {
            return angle * Math.PI / 180;
        }
        /// <summary>
        /// 弧度转角度
        /// </summary>
        /// <param name="rad">弧度</param>
        /// <returns>角度</returns>
        public static double RedToAng(this double rad)
        {
            return rad * 180 / Math.PI;
        }
        /// <summary>
        /// 多组0开始的连续数字分割
        /// </summary>
        /// <param name="numbers">数字集合</param>
        /// <returns></returns>
        public static List<List<int>> SpireContionsNumbers(this List<int> numbers)
        {
            var result = new List<List<int>>();
            var currentList = new List<int>();
            for (int i = 0; i < numbers.Count; i++)
            {
                if (i > 0 && numbers[i] == 0)
                {
                    result.Add(currentList);
                    currentList = new List<int>();
                }
                currentList.Add(numbers[i]);
            }
            result.Add(currentList);
            return result;
        }



    }
}
